<template>
  <div></div>
</template>

<script>
import { Dialog } from "vant";

export default {
  name: "DialogCustom",
  components: {
    [Dialog.name]: Dialog
  },
  props: {
    // 标题
    title: {
      type: String,
      default: ""
    },
    // model
    message: {
      type: String,
      default: ""
    },
    // 是否展示确认按钮
    showConfirmButton: {
      type: Boolean,
      default: true
    },
    // 是否展示取消按钮
    showCancelButton: {
      type: Boolean,
      default: false
    },
    // 确认按钮文案
    confirmButtonText: {
      type: String,
      default: ""
    },
    // 取消按钮文案
    cancelButtonText: {
      type: String,
      default: ""
    },
    // 确认按钮颜色
    confirmButtonColor: {
      type: String,
      default: ""
    },
    // 取消按钮颜色
    cancelButtonColor: {
      type: String,
      default: ""
    }
  },
  methods: {
    showDialog() {
      Dialog.alert({
        title: this.title,
        message: this.message,
        showConfirmButton: this.showConfirmButton,
        showCancelButton: this.showCancelButton,
        confirmButtonText: this.confirmButtonText,
        cancelButtonText: this.cancelButtonText,
        confirmButtonColor: this.confirmButtonColor,
        cancelButtonColor: this.cancelButtonColor
      }).then((res) => {
        if (res === "confirm") {
          return this.$emit('confirm')
        }
        this.$emit('cancel')
      });
    }
  }
};
</script>

<style  lang="less">
</style>
